---
title: "switch · RUAL Documentation"
description: "Returns state based of the given expression."
canonical: https://docs.rual.nl/block-types/state ui/state_switch
language: en
---

# switch

This block is part of the [`state ui`](https://docs.rual.nl/block-types/state%20ui) group and was last modified in core [`v10.4.28`](https://docs.rual.nl/core-versions/100428).

Returns state based of the given expression.

- expression required `value` The expression to evaluate.

- default `state` The default statement to be executed.

- output `state` Returns the state matching the expression.

- match `condition` Returns true in case a match was found.

A typical wiring for [switch](https://docs.rual.nl/block-types/state%20ui/state_switch): the `state` out pin feeds [get component child](https://docs.rual.nl/block-types/state%20actions/state_component_get_child).

![Studio canvas example for the switch block: typical wiring for switch.](https://docs.rual.nl/canvas-examples/state_switch.png)

### Version history

Introduced in [`v10.4.28`](https://docs.rual.nl/core-versions/100428).
